import { View } from "@tarojs/components";
import { Tag } from "@nutui/nutui-react-taro";
import React from "react";
import { type AddressView } from "@/apis/__generated/model/static";
import "./address-row.scss";

export default function AddressRow({
  address,
  operation,
}: {
  address: AddressView;
  operation?: React.JSX.Element;
}) {
  return (
    <View className="address-row">
      <View className="info">
        <View className="details">
          {address.details + " " + address.houseNumber}
        </View>
        <View className="connector">
          <View className="real-name">{address.realName}</View>
          <View className="phone-number">{address.phoneNumber}</View>
          {address.top ? (
            <View className="is-default">
              <Tag plain type="success">
                默认
              </Tag>
            </View>
          ) : (
            ""
          )}
        </View>
      </View>
      {operation}
    </View>
  );
}
